package com.fit.spring.boot.proxy.interceptor.extension;

import java.lang.reflect.Method;
import java.util.HashMap;

/**
 * 方法配置器
 * @author hcl
 *
 */
public class Config {

	
	
	/**
	 * beanclass对象
	 */
	private Class<?> beanClass;
	
	/**
	 * 方法对象
	 */
	private Method method;
	
	
	/**
	 * 拦截方法参数
	 */
	private HashMap<String, Object> methodParam = new HashMap<>();
	
	
	/**
	 * 初始化beanClass和method
	 * @param beanClass
	 * @param method
	 */
	public Config(Class<?> beanClass, Method method) {
		super();
		this.beanClass = beanClass;
		this.method = method;
	}
	
	
	/**
	 * 给当前方法添加键值对
	 * @param key
	 * @param val
	 */
	public void put(String key, Object val){
		if(key != null){
			methodParam.put(key, val);
		}
	}
	
	/**
	 * 给当前方法添加多个键值对
	 * @param methodParam
	 */
	public void putAll(HashMap<String, Object> methodParam){
		if(methodParam != null && !methodParam.isEmpty()){
			this.methodParam.putAll(methodParam);
		}
	}


	public HashMap<String, Object> getMethodParam() {
		return methodParam;
	}


	public Class<?> getBeanClass() {
		return beanClass;
	}

	public void setBeanClass(Class<?> beanClass) {
		this.beanClass = beanClass;
	}

	public Method getMethod() {
		return method;
	}

	public void setMethod(Method method) {
		this.method = method;
	}
}
